/////////////////////////
// 	DDCombo.h	:	v0010
//	Written by 	:	Li	Haijun
//	Compiler	:	Microsoft Visual C++ 4.0
//	v0010		:	Dec.9.1996
/////////////////////////

/////////////////////////////////////////////////////////////////////////////
// CDcombo class
#ifndef __DDCOMBO_H__
#define __DDCOMBO_H__

#include	"stdafx.h"
#include	"ddapi.h"

/////////////////////////////////////////
// to test whether a combo box is clicked
/////////////////////////////////////////
BOOL	LeftButtonDownOnComboBox(int xPos, int yPos);
// to test whether cursor is moved on a combo box
BOOL	MouseMoveOnComboBox(int xPos, int yPos);
/////////////////////////////////////////
//	to release all bitmap of list when you exit this game
void	FACE_DeleteAllComboBox();
// to restore all combo-box that in pAllComboBox[MAX_COMBOBOX] to COMBOBOX_UP state
void	FACE_RestoreAllComboBoxState( );
///////////////////////////////////////////////////////////////////////
// class declear
class CDDComboBox
{
	//member
private:
// the surface that this combo box is load on
	CDDSurface		m_BitmapSurface;
// a surface to keep the sheltered background when a combo-box popup
	CDDSurface *	m_pShelterSurface;
public:
// the list unit that include in this combo
	CDDListUnit		m_ListUnit;
// Attributes
private:
public:
	int		m_nFileNameId;	// name of this DIB file name
	char	m_ShowString[20]; // the string that show in this combo-box
	SIZE	m_szOneBitmap;	// the size of one state of a bitmap combo
	RECT	m_rTotal;		// there is four state of a bitmap combo in a DIB file	
	RECT	m_rCurrent;		// the rectangle of current state bitmap combo
	int		m_dwX, m_dwY;		// the position of a bitmap combo on the surface

	int  m_nID;		// combo id
	int  m_nState;	// combo state,0-up,1-focus,2-disable
	int  m_nPart;	// how many part should the dib image file be devided
					// that means,how many state image in one dib file
	BOOL m_bEnableSound;	// true for enable sound effects
public:
	CDDComboBox();		//constructor
	~CDDComboBox();		//destructor

// Initialize the data member
public:	
// initializes
	BOOL PreLoad(int FilenameId, int x, int y, int OneBitmapWidth=0, int OneBitmapHeight=0); //, int part);	// always used in the contructor of its parent
	void Release(void);
//	void LoadSound(LPCTSTR lpszDown, LPCTSTR lpszUp, LPCTSTR lpszDisable);	// for playing sound
// attributes
	// set the state of this bitmap combo
	void SetID(int ID);	//to set this combo's ID
	// set the state of this combo box
	void SetState(int state);	// let combo up or focus or ...
	// to get the state of this combo box
	int  GetState(void);
	// to get the size of this combo box
	SIZE GetSize(void){return m_szOneBitmap;}
// operations
	//to test if the given point on this button
	BOOL OnComboBox( int x, int y);
	// to show the combo-box
	void Show();													      
	// to show the list unit of this combo-box
	BOOL ShowListUnit(void);
	// to close the list unit of this combo-box
	void CloseListUnit(void);
	// to get the sheltered background and record it into a surface
	BOOL GetShelterBackGround(void);
	// to restore the shelter background when you close the combo-box
	void RestoreShelterBackGround(void);
};
/////////////////////////////////////////////////////////////////////////////
#endif

